package com.gxa.web_admin.controller;

import com.gxa.common.vo.JsonResult;
import com.gxa.common.vo.R;
import com.gxa.modules.pojo.WaybillAbnormal;
import com.gxa.modules.service.Waybill_abnormalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/waybill_abnormal")
public class Waybill_abnormalController {
    @Autowired
    private Waybill_abnormalService waybill_abnormalService;

    /**
     * 分页查询运单异常
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping("/findWaybill_abnorma")
    public JsonResult findWaybill_abnormal(Integer currentPage, Integer pageSize){
        return waybill_abnormalService.findWaybill_abnormal(currentPage,pageSize);
    }

    /**
     * 增加运单异常
     * @param waybillAbnormal
     * @return
     */
    @PostMapping("/addWaybill_abnormal")
    public R addWaybill_abnormal(WaybillAbnormal waybillAbnormal){
        return waybill_abnormalService.addWaybill_abnormal(waybillAbnormal);
    }

    /**
     * 删除运单异常
     * @param id
     * @return
     */
    @PostMapping("/deleteWaybill_abnormal")
    public R deleteWaybill_abnormal(Integer id){
        return waybill_abnormalService.deleteWaybill_abnormal(id);
    }
    /**
     * 批量删除运单异常
     * @param ids
     * @return
     */
    @PostMapping("/deleteWaybill_abnormalList")
    public R deleteWaybill_abnormalList(int[] ids){
        return waybill_abnormalService.deleteWaybill_abnormalList(ids);
    }

    /**
     * 修改运单异常
     * @param waybillAbnormal
     * @return
     */
    @PostMapping("/updateWaybill_abnormal")
    public R updateWaybill_abnormal(WaybillAbnormal waybillAbnormal){
        return waybill_abnormalService.updateWaybill_abnormal(waybillAbnormal);
    }

    /**
     * 查看运单异常
     * @param id
     * @return
     */
    @PostMapping("/seeWaybill_abnormal")
    public JsonResult seewaybill_abnormal(Integer id){
        return waybill_abnormalService.seeWaybill_abnormal(id);
    }

    /**
     * 添加处理
     * @param id
     * @param deal_note
     * @param deal_time
     * @return
     */
    @PostMapping("/dealWaybill_abnormal")
    public R dealWaybill_abnormal(Integer id, String deal_note, String deal_time){
        return waybill_abnormalService.dealWaybill_abnormal(id,deal_note,deal_time);
    }

    /**
     * 添加完结
     * @param id
     * @param end_note
     * @param end_time
     * @return
     */
    @PostMapping("/endWaybill_abnormal")
    public R endWaybill_abnormal(Integer id, String end_note, String end_time){
        return waybill_abnormalService.endWaybill_abnormal(id,end_note,end_time);
    }

    /**
     * 条件搜索运单异常
     * @param waybillId
     * @param abnorLink
     * @param type
     * @param time
     * @return
     */
    @PostMapping("/searchWaybill_abnormal")
    public JsonResult searchWaybill_abnormal(String waybillId, Integer abnorLink, Integer type, String time){
        return waybill_abnormalService.searchWaybill_abnormal(waybillId,abnorLink,type,time);
    }
}
